#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>

char* readFile(const char* path) {
	FILE* fp = fopen(path, "rb");
	if (!fp) {
		fprintf(stderr, "Open %s failed.\n", path);
		exit(1);
	}

	fseek(fp, 0L, SEEK_END);
	long file_size = ftell(fp);
	rewind(fp);

	char* content = malloc(file_size + 1);
	if (!content) {
		fprintf(stderr, "malloc failed in readFile.\n");
		exit(1);
	}
	
	int n = fread(content, 1, file_size, fp);
	content[n] = '\0';

	return content;
}


int main(int argc, char* argv[]) {
	char* content = readFile(argv[1]);
	// ...
	free(content);
	return 0;
}